package com.runfast.paotui.dao.model;

import com.runfast.pay.Channel;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

public class Order implements Serializable {
    //跑腿定单列表
    public enum Status {CREATED, CANCELED, PAID, TAKEN, COMPLETED,PICKED}
    //  0  created=下单 1 canceled=取消订单  2paid=付款成功 3taken=待取货时状态 4completed==订单完成 5picked=配送时的状态
    public enum FromType {SPECIFIED, NEARBY}

    public enum Type {DAIGOU, QUSONGJIAN}
//0 specified 为代购 1 为就近


    public interface Daigou {

    }

    public interface Qusongjian {
    }

    public interface Specified {
    }

    public interface NearBy {
    }
   //新增的一个状态属性， status1为9时，是异常情况


    private Integer id;
    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 已支付金额
     */
    private Integer amountPaid;

    /**
     * 应支付金额
     */
    private Integer amountPayable;

    /**
     * 配送费
     */
    private Integer deliveryCost;

    /**
     * 源地址
     */
    @NotBlank(groups = {Specified.class})
    private String fromAddress;

    /**
     * 源纬度
     */
    @NotNull(groups = {Specified.class})
    private Double fromLat;

    /**
     * 源经度
     */
    @NotNull(groups = {Specified.class})
    private Double fromLng;

    /**
     * 源地址类型
     */
    @NotNull(groups = {Daigou.class})
    private FromType fromType;

    /**
     * 商品描述
     */
    @NotBlank(groups = {Daigou.class})
    private String goodsDescription;

    /**
     * 商品类型
     */
    @NotNull(groups = {Qusongjian.class})
    private String goodsType;

    /**
     * 商品重量
     */
    @NotNull(groups = {Qusongjian.class})
    private Integer goodsWeight;

    /**
     * 保险
     */
    private Integer insurance;

    /**
     * 订单号
     */
    private String orderNo;

    /**
     * 订单状态
     */
    private Status status;

    /**
     * 取货时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(groups = {Qusongjian.class})
    private Date pickTime;

    /**
     * 备注
     */
    private String remark;

    /**
     * 建议商品价格
     */
    private Integer suggestionCost;

    /**
     * 小费
     */
    private Integer tip;

    /**
     * 当前订单所属用户
     */
    private Integer cuserId;

    /**
     * 骑手id
     */
    private Integer driverId;

    /**
     * 源地址id
     */
    @NotNull(groups = {Qusongjian.class})
    private Integer fromId;

    /**
     * 目的地id
     */
    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Integer toId;

    /**
     * 订单类型
     */
    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Type type;

    /**
     * 距离
     */
    private Integer distance;

    /**
     * 预计配送时间
     */
    private Integer deliveryDuration;

    /**
     * 骑手收入
     */
    private Integer driverIncome;

    /**
     * 平台收入
     */
    private Integer plateformIncome;

    /**
     * 叶子节点代理商收入
     */
    private Integer agentIncome;
    String overTime;//新加字段
    String fromPhone ;
    String  fromName;
    Integer gender;//送达人的性别
    Integer fromgender;//从哪取件的人的性别
    Integer isCancel; //1:用户提出 2:骑手同意3:不同意；4：系统超时确认
    Date bookTime; //预定单时间

    public Date getBookTime() {
        return bookTime;
    }

    public void setBookTime(Date bookTime) {
        this.bookTime = bookTime;
    }


    public Integer getIsCancel() {
        return isCancel;
    }

    public void setIsCancel(Integer isCancel) {
        this.isCancel = isCancel;
    }



    public Integer getFromgender() {
        return fromgender;
    }

    public void setFromgender(Integer fromgender) {
        this.fromgender = fromgender;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public Long getReturnTime() {
        return returnTime;
    }

    public void setReturnTime(Long returnTime) {
        this.returnTime = returnTime;
    }

    Long returnTime;


    public String getFromName() {
        return fromName;
    }

    public void setFromName(String fromName) {
        this.fromName = fromName;
    }



    public String getFromPhone() {
        return fromPhone;
    }

    public void setFromPhone(String fromPhone) {
        this.fromPhone = fromPhone;
    }




    public String getOverTime() {
        return overTime;
    }

    public void setOverTime(String overTime) {
        this.overTime = overTime;
    }

    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Double userLng;
    @NotNull(groups = {Daigou.class, Qusongjian.class})
    private Double userLat;

    /**
     * 附近代理商
     */
    private Integer agentId;

    /**
     * 退款总金额
     */
    private Integer amountRefunded;

    /**
     * 是否存在退款
     */
    private Boolean refunded;

    /**
     * 是否已支付
     */
    private Boolean paid;

    /**
     * 是否已取消
     */
    private Boolean canceled;

    /**
     * 是否已接单
     */
    private Boolean taken;

    /**
     * 是否已完成
     */
    private Boolean completed;

    private Date timePaid;

    private Date timeCanceled;

    private Date timeTaken;

    private Date timeCompleted;

    /**
     * 支付渠道
     */
    private Channel channel;

    private Boolean deleted;
    private String toAddress;
    private String  toName;
    private String toMobile ;
    public String getToAddress() {
        return toAddress;
    }

    public void setToAddress(String toAddress) {
        this.toAddress = toAddress;
    }

    public String getToName() {
        return toName;
    }

    public void setToName(String toName) {
        this.toName = toName;
    }

    public String getToMobile() {
        return toMobile;
    }

    public void setToMobile(String toMobile) {
        this.toMobile = toMobile;
    }



    private static final long serialVersionUID = 1L;

    public Integer getId() {
        return id;
    }

    public Order withId(Integer id) {
        this.setId(id);
        return this;
    }

    public void setId(Integer id) {
        this.id = id;
    }


    public Date getCreateTime() {
        return createTime;
    }

    public Order withCreateTime(Date createTime) {
        this.setCreateTime(createTime);
        return this;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public Order withUpdateTime(Date updateTime) {
        this.setUpdateTime(updateTime);
        return this;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getAmountPaid() {
        return amountPaid;
    }

    public Order withAmountPaid(Integer amountPaid) {
        this.setAmountPaid(amountPaid);
        return this;
    }

    public void setAmountPaid(Integer amountPaid) {
        this.amountPaid = amountPaid;
    }

    public Integer getAmountPayable() {
        return amountPayable;
    }

    public Order withAmountPayable(Integer amountPayable) {
        this.setAmountPayable(amountPayable);
        return this;
    }

    public void setAmountPayable(Integer amountPayable) {
        this.amountPayable = amountPayable;
    }

    public Integer getDeliveryCost() {
        return deliveryCost;
    }

    public Order withDeliveryCost(Integer deliveryCost) {
        this.setDeliveryCost(deliveryCost);
        return this;
    }

    public void setDeliveryCost(Integer deliveryCost) {
        this.deliveryCost = deliveryCost;
    }

    public String getFromAddress() {
        return fromAddress;
    }

    public Order withFromAddress(String fromAddress) {
        this.setFromAddress(fromAddress);
        return this;
    }

    public void setFromAddress(String fromAddress) {
        this.fromAddress = fromAddress == null ? null : fromAddress.trim();
    }

    public Double getFromLat() {
        return fromLat;
    }

    public Order withFromLat(Double fromLat) {
        this.setFromLat(fromLat);
        return this;
    }

    public void setFromLat(Double fromLat) {
        this.fromLat = fromLat;
    }

    public Double getFromLng() {
        return fromLng;
    }

    public Order withFromLng(Double fromLng) {
        this.setFromLng(fromLng);
        return this;
    }

    public void setFromLng(Double fromLng) {
        this.fromLng = fromLng;
    }

    public FromType getFromType() {
        return fromType;
    }

    public Order withFromType(FromType fromType) {
        this.setFromType(fromType);
        return this;
    }

    public void setFromType(FromType fromType) {
        this.fromType = fromType;
    }

    public String getGoodsDescription() {
        return goodsDescription;
    }

    public Order withGoodsDescription(String goodsDescription) {
        this.setGoodsDescription(goodsDescription);
        return this;
    }

    public void setGoodsDescription(String goodsDescription) {
        this.goodsDescription = goodsDescription == null ? null : goodsDescription.trim();
    }

    public String getGoodsType() {
        return goodsType;
    }

    public Order withGoodsType(String goodsType) {
        this.setGoodsType(goodsType);
        return this;
    }

    public void setGoodsType(String goodsType) {
        this.goodsType = goodsType;
    }

    public Integer getGoodsWeight() {
        return goodsWeight;
    }

    public Order withGoodsWeight(Integer goodsWeight) {
        this.setGoodsWeight(goodsWeight);
        return this;
    }

    public void setGoodsWeight(Integer goodsWeight) {
        this.goodsWeight = goodsWeight;
    }

    public Integer getInsurance() {
        return insurance;
    }

    public Order withInsurance(Integer insurance) {
        this.setInsurance(insurance);
        return this;
    }

    public void setInsurance(Integer insurance) {
        this.insurance = insurance;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public Order withOrderNo(String orderNo) {
        this.setOrderNo(orderNo);
        return this;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo == null ? null : orderNo.trim();
    }

    public Status getStatus() {
        return status;
    }

    public Order withStatus(Status status) {
        this.setStatus(status);
        return this;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public Date getPickTime() {
        return pickTime;
    }

    public Order withPickTime(Date pickTime) {
        this.setPickTime(pickTime);
        return this;
    }

    public void setPickTime(Date pickTime) {
        this.pickTime = pickTime;
    }

    public String getRemark() {
        return remark;
    }

    public Order withRemark(String remark) {
        this.setRemark(remark);
        return this;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    public Integer getSuggestionCost() {
        return suggestionCost;
    }

    public Order withSuggestionCost(Integer suggestionCost) {
        this.setSuggestionCost(suggestionCost);
        return this;
    }

    public void setSuggestionCost(Integer suggestionCost) {
        this.suggestionCost = suggestionCost;
    }

    public Integer getTip() {
        return tip;
    }

    public Order withTip(Integer tip) {
        this.setTip(tip);
        return this;
    }

    public void setTip(Integer tip) {
        this.tip = tip;
    }

    public Integer getCuserId() {
        return cuserId;
    }

    public Order withCuserId(Integer cuserId) {
        this.setCuserId(cuserId);
        return this;
    }

    public void setCuserId(Integer cuserId) {
        this.cuserId = cuserId;
    }

    public Integer getDriverId() {
        return driverId;
    }

    public Order withDriverId(Integer driverId) {
        this.setDriverId(driverId);
        return this;
    }

    public void setDriverId(Integer driverId) {
        this.driverId = driverId;
    }

    public Integer getFromId() {
        return fromId;
    }

    public Order withFromId(Integer fromId) {
        this.setFromId(fromId);
        return this;
    }

    public void setFromId(Integer fromId) {
        this.fromId = fromId;
    }

    public Integer getToId() {
        return toId;
    }

    public Order withToId(Integer toId) {
        this.setToId(toId);
        return this;
    }

    public void setToId(Integer toId) {
        this.toId = toId;
    }

    public Type getType() {
        return type;
    }

    public Order withType(Type type) {
        this.setType(type);
        return this;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public Integer getDistance() {
        return distance;
    }

    public Order withDistance(Integer distance) {
        this.setDistance(distance);
        return this;
    }

    public void setDistance(Integer distance) {
        this.distance = distance;
    }

    public Integer getDeliveryDuration() {
        return deliveryDuration;
    }

    public Order withDeliveryDuration(Integer deliveryDuration) {
        this.setDeliveryDuration(deliveryDuration);
        return this;
    }

    public void setDeliveryDuration(Integer deliveryDuration) {
        this.deliveryDuration = deliveryDuration;
    }

    public Integer getDriverIncome() {
        return driverIncome;
    }

    public Order withDriverIncome(Integer driverIncome) {
        this.setDriverIncome(driverIncome);
        return this;
    }

    public void setDriverIncome(Integer driverIncome) {
        this.driverIncome = driverIncome;
    }

    public Integer getPlateformIncome() {
        return plateformIncome;
    }

    public Order withPlateformIncome(Integer plateformIncome) {
        this.setPlateformIncome(plateformIncome);
        return this;
    }

    public void setPlateformIncome(Integer plateformIncome) {
        this.plateformIncome = plateformIncome;
    }

    public Integer getAgentIncome() {
        return agentIncome;
    }

    public Order withAgentIncome(Integer agentIncome) {
        this.setAgentIncome(agentIncome);
        return this;
    }

    public void setAgentIncome(Integer agentIncome) {
        this.agentIncome = agentIncome;
    }

    public Double getUserLng() {
        return userLng;
    }

    public Order withUserLng(Double userLng) {
        this.setUserLng(userLng);
        return this;
    }

    public void setUserLng(Double userLng) {
        this.userLng = userLng;
    }

    public Double getUserLat() {
        return userLat;
    }

    public Order withUserLat(Double userLat) {
        this.setUserLat(userLat);
        return this;
    }

    public void setUserLat(Double userLat) {
        this.userLat = userLat;
    }

    public Integer getAgentId() {
        return agentId;
    }

    public Order withAgentId(Integer agentId) {
        this.setAgentId(agentId);
        return this;
    }

    public void setAgentId(Integer agentId) {
        this.agentId = agentId;
    }

    public Integer getAmountRefunded() {
        return amountRefunded;
    }

    public Order withAmountRefunded(Integer amountRefunded) {
        this.setAmountRefunded(amountRefunded);
        return this;
    }

    public void setAmountRefunded(Integer amountRefunded) {
        this.amountRefunded = amountRefunded;
    }

    public Boolean getRefunded() {
        return refunded;
    }

    public Order withRefunded(Boolean refunded) {
        this.setRefunded(refunded);
        return this;
    }

    public void setRefunded(Boolean refunded) {
        this.refunded = refunded;
    }

    public Boolean getPaid() {
        return paid;
    }

    public Order withPaid(Boolean paid) {
        this.setPaid(paid);
        return this;
    }

    public void setPaid(Boolean paid) {
        this.paid = paid;
    }

    public Boolean getCanceled() {
        return canceled;
    }

    public Order withCanceled(Boolean canceled) {
        this.setCanceled(canceled);
        return this;
    }

    public void setCanceled(Boolean canceled) {
        this.canceled = canceled;
    }

    public Boolean getTaken() {
        return taken;
    }

    public Order withTaken(Boolean taken) {
        this.setTaken(taken);
        return this;
    }

    public void setTaken(Boolean taken) {
        this.taken = taken;
    }

    public Boolean getCompleted() {
        return completed;
    }

    public Order withCompleted(Boolean completed) {
        this.setCompleted(completed);
        return this;
    }

    public void setCompleted(Boolean completed) {
        this.completed = completed;
    }

    public Date getTimePaid() {
        return timePaid;
    }

    public Order withTimePaid(Date timePaid) {
        this.setTimePaid(timePaid);
        return this;
    }

    public void setTimePaid(Date timePaid) {
        this.timePaid = timePaid;
    }

    public Date getTimeCanceled() {
        return timeCanceled;
    }

    public Order withTimeCanceled(Date timeCanceled) {
        this.setTimeCanceled(timeCanceled);
        return this;
    }

    public void setTimeCanceled(Date timeCanceled) {
        this.timeCanceled = timeCanceled;
    }

    public Date getTimeTaken() {
        return timeTaken;
    }

    public Order withTimeTaken(Date timeTaken) {
        this.setTimeTaken(timeTaken);
        return this;
    }

    public void setTimeTaken(Date timeTaken) {
        this.timeTaken = timeTaken;
    }

    public Date getTimeCompleted() {
        return timeCompleted;
    }

    public Order withTimeCompleted(Date timeCompleted) {
        this.setTimeCompleted(timeCompleted);
        return this;
    }

    public void setTimeCompleted(Date timeCompleted) {
        this.timeCompleted = timeCompleted;
    }

    public Channel getChannel() {
        return channel;
    }

    public Order withChannel(Channel channel) {
        this.setChannel(channel);
        return this;
    }

    public void setChannel(Channel channel) {
        this.channel = channel;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", amountPaid=").append(amountPaid);
        sb.append(", amountPayable=").append(amountPayable);
        sb.append(", deliveryCost=").append(deliveryCost);
        sb.append(", fromAddress=").append(fromAddress);
        sb.append(", fromLat=").append(fromLat);
        sb.append(", fromLng=").append(fromLng);
        sb.append(", fromType=").append(fromType);
        sb.append(", goodsDescription=").append(goodsDescription);
        sb.append(", goodsType=").append(goodsType);
        sb.append(", goodsWeight=").append(goodsWeight);
        sb.append(", insurance=").append(insurance);
        sb.append(", orderNo=").append(orderNo);
        sb.append(", status=").append(status);
        sb.append(", pickTime=").append(pickTime);
        sb.append(", remark=").append(remark);
        sb.append(", suggestionCost=").append(suggestionCost);
        sb.append(", tip=").append(tip);
        sb.append(", cuserId=").append(cuserId);
        sb.append(", driverId=").append(driverId);
        sb.append(", fromId=").append(fromId);
        sb.append(", toId=").append(toId);
        sb.append(", type=").append(type);
        sb.append(", distance=").append(distance);
        sb.append(", deliveryDuration=").append(deliveryDuration);
        sb.append(", driverIncome=").append(driverIncome);
        sb.append(", plateformIncome=").append(plateformIncome);
        sb.append(", agentIncome=").append(agentIncome);
        sb.append(", userLng=").append(userLng);
        sb.append(", userLat=").append(userLat);
        sb.append(", agentId=").append(agentId);
        sb.append(", amountRefunded=").append(amountRefunded);
        sb.append(", refunded=").append(refunded);
        sb.append(", paid=").append(paid);
        sb.append(", canceled=").append(canceled);
        sb.append(", taken=").append(taken);
        sb.append(", completed=").append(completed);
        sb.append(", timePaid=").append(timePaid);
        sb.append(", timeCanceled=").append(timeCanceled);
        sb.append(", timeTaken=").append(timeTaken);
        sb.append(", timeCompleted=").append(timeCompleted);
        sb.append(", channel=").append(channel);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}